package org.management.utils;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class EncryptUtils {
	/**
	 * 加密方式
	 */
	private static final String ENCRYPT_METHOD = "MD5";
	/**
	 * 加密次数
	 */
	private static final int ENCRYPT_NUMBER = 2;

	public static final String  ENCRYPT_SALT = ".&&.";

    /**
     * 加盐
     * @param password 密码
     * @param salt 用户名
     * @return 加密密码
     */
	public static String  encryptPassword(String password, String salt) {
		return new SimpleHash(ENCRYPT_METHOD, password, ByteSource.Util.bytes(salt),
                ENCRYPT_NUMBER).toHex();
	}
    public static void main(String[] args) {
		System.out.println(encryptPassword("1","admin"));
	}
}
